package com.lwj.liwanjia.model;

import com.lwj.liwanjia.api.ApiService;
import com.lwj.liwanjia.bean.SuperMarketBean;
import com.lwj.liwanjia.utils.RetrofitHelper;

import java.util.Map;

import retrofit2.http.Query;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by Administrator on 2017/9/25.
 */

public class SuperMarketModel {
    public void getSuperMarketData(String type, double userLat, double userLng
            , String marketType, int page, Subscriber<SuperMarketBean> subscriber) {
        if (type.equals("距离")) {
            RetrofitHelper.getSingleRetrofit()
                    .create(ApiService.class)
                    .getSuperMakertData1(userLat, userLng, marketType, page)
                    .subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(subscriber);
        } else if (type.equals("好评度")) {
            RetrofitHelper.getSingleRetrofit()
                    .create(ApiService.class)
                    .getSuperMakertData(userLat, userLng, marketType, page)
                    .subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(subscriber);
        }
    }
}
